<%--
  Created by IntelliJ IDEA.
  User: lxm
  Date: 2018/5/5
  Time: 下午2:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <jsp:include page="/static/common/stylesheets.jsp"></jsp:include>
    <jsp:include page="nav.jsp"></jsp:include>

    <link href="/static/layui/css/doc.css" rel="stylesheet">
    <title>文件分词</title>
    <style>
        p {
            font-size: 16px;
            line-height: 2;
        }

        .icon {
            position: relative;
            font-size: 15px;
            height: 32px;
            display: block;
            fill: rgba(51, 51, 51, 0.5);
            margin-right: 20px;
            -webkit-transition: all .2s ease-out;
            transition: all .2s ease-out;
        }

        .icon.active {
            fill: #E74C3C;
        }

        .icon.big {
            width: 64px;
            height: 64px;
            fill: rgba(51, 51, 51, 0.5);
        }

        #wrapper {
            min-height: 700px;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            margin: auto;
            background-color: #fff;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
            display: -webkit-box;
            display: -webkit-flex;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-align: center;
            -webkit-align-items: center;
            -ms-flex-align: center;
            align-items: center;
            -webkit-box-pack: left;
            -webkit-justify-content: left;
            -ms-flex-pack: left;
            justify-content: left;

        }

        #left-side {
            height: 70%;
            width: 15%;
            display: -webkit-box;
            display: -webkit-flex;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-align: center;
            -webkit-align-items: center;
            -ms-flex-align: center;
            align-items: center;
            -webkit-box-pack: center;
            -webkit-justify-content: center;
            -ms-flex-pack: center;
            justify-content: center;
        }

        #left-side ul li {
            padding-top: 10px;
            padding-bottom: 10px;
            display: -webkit-box;
            display: -webkit-flex;
            display: -ms-flexbox;
            display: flex;
            line-height: 34px;
            color: rgba(51, 51, 51, 0.5);
            font-weight: 500;
            cursor: pointer;
            -webkit-transition: all .2s ease-out;
            transition: all .2s ease-out;
        }

        #left-side ul li:hover {
            color: #333333;
            -webkit-transition: all .2s ease-out;
            transition: all .2s ease-out;
        }

        #left-side ul li:hover > .icon {
            fill: #333;
        }

        #left-side ul li.active {
            color: #333333;
        }

        #left-side ul li.active:hover > .icon {
            fill: #E74C3C;
        }

        #border {
            height: 600px;
            width: 1px;
            background-color: rgba(51, 51, 51, 0.2);
        }

        #border #line {
            width: 5px;
            height: 54px;
            background-color: #E74C3C;
            margin-left: -2px;
            margin-top: 7px;
            -webkit-transition: all .4s ease-in-out;
            transition: all .4s ease-in-out;
        }

        #right-side {
            /*height: 300px;*/
            min-height: 650px;
            width: 85%;
            /*overflow: hidden;*/
        }

        #right-side #first, #right-side #second, #right-side #third, #right-side #fourth {
            position: absolute;
            height: 300px;
            width: 75%;
            -webkit-transition: all .6s ease-in-out;
            transition: all .6s ease-in-out;
            margin-top: -350px;
            opacity: 0;
            display: -webkit-box;
            display: -webkit-flex;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-align: center;
            -webkit-align-items: center;
            -ms-flex-align: center;
            align-items: center;
            -webkit-box-pack: center;
            -webkit-justify-content: center;
            -ms-flex-pack: center;
            justify-content: center;
            -webkit-box-orient: vertical;
            -webkit-box-direction: normal;
            -webkit-flex-direction: column;
            -ms-flex-direction: column;
            flex-direction: column;
        }

        #right-side #first.active, #right-side #second.active, #right-side #third.active, #right-side #fourth.active {
            margin-top: 0px;
            opacity: 1;
            -webkit-transition: all .6s ease-in-out;
            transition: all .6s ease-in-out;
        }

        .tab-active {
            color: #333333;
            margin-top: 0px;
            opacity: 1;
            -webkit-transition: all .6s ease-in-out;
            transition: all .6s ease-in-out;
        }

        .tab-content-active {
            margin-top: 0px;
            opacity: 1;
            -webkit-transition: all .6s ease-in-out;
            transition: all .6s ease-in-out;
        }
    </style>

</head>
<body>
<jsp:include page="/static/common/header.jsp"></jsp:include>

<div class="layui-main site-inline">
    <jsp:include page="/static/common/docs.jsp"></jsp:include>

    <div class="site-content">
        <h1 class="site-h1">简介 - 文件分词</h1>
        <p>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;本自然语言处理与数据可视化平台，为了更丰富常用功能的接口，自然语言处理平台设计了文件处理与网页处理的模块。文件处理使用了Spring
            MVC中File
            Upload模块作为后端支持，以LayUI提供的Upload模块作为前端UI与响应的支持。用户在选择上传的文件后，由LayUI.js发起AJAX调用，后端接收到文件后，以字符串的形式读取文件文本信息，并执行分词操作。
        </p>
        <fieldset class="layui-elem-field layui-field-title site-title">
            <legend><a name="compatibility">文件接口</a></legend>
        </fieldset>
        <blockquote><p>注:文件接口限制文本文件大小，最大为10MB。</p></blockquote>
        <pre class="md-fences md-end-block" lang="powershell"> <div class="CodeMirror cm-s-inner CodeMirror-wrap"><div
                style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div
                class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler"
                                                                                     cm-not-content="true"></div><div
                class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer"
                                                             style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div
                style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div
                role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div
                class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div
                class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline"
                                                                          style="position: relative;"><div
                class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div
                class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre
                class=" CodeMirror-line " role="presentation"><span role="presentation"
                                                                    style="padding-right: 0.1px;"><span
                class="cm-error">请求方法</span><span class="cm-operator">:</span><span
                class="cm-identifier">POST</span></span></pre></div><pre class=" CodeMirror-line "
                                                                         role="presentation"><span role="presentation"
                                                                                                   style="padding-right: 0.1px;"><span
                class="cm-error">请求</span><span class="cm-identifier">URL</span><span class="cm-operator">:</span> <span
                class="cm-identifier">http</span><span class="cm-operator">://</span><span
                class="cm-identifier">host</span><span class="cm-operator">:</span><span
                class="cm-identifier">port</span><span class="cm-operator">/</span><span
                class="cm-identifier">file</span><span class="cm-operator">/</span><span
                class="cm-identifier">upload</span><span class="cm-operator">/</span><span
                class="cm-identifier">seg</span><span class="cm-punctuation">.</span><span class="cm-keyword">do</span></span></pre><pre
                class=" CodeMirror-line " role="presentation"><span role="presentation"
                                                                    style="padding-right: 0.1px;"><span
                class="cm-error">请求</span><span class="cm-identifier">Body</span><span
                class="cm-operator">:</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span
                role="presentation" style="padding-right: 0.1px;"><span class="cm-identifier">Content-Disposition</span><span
                class="cm-operator">:</span> <span class="cm-identifier">form-data</span><span
                class="cm-punctuation">;</span> <span class="cm-identifier">name</span><span
                class="cm-operator">=</span><span class="cm-string">"file"</span><span
                class="cm-punctuation">;</span> <span class="cm-identifier">filename</span><span
                class="cm-operator">=</span><span class="cm-string">"文本文件的名字.txt"</span></span></pre><pre
                class=" CodeMirror-line " role="presentation"><span role="presentation"
                                                                    style="padding-right: 0.1px;"><span
                class="cm-identifier">Content-Type</span><span class="cm-operator">:</span> <span class="cm-identifier">text</span><span
                class="cm-operator">/</span><span class="cm-identifier">plain</span></span></pre><pre
                class=" CodeMirror-line " role="presentation"><span role="presentation"
                                                                    style="padding-right: 0.1px;"><span cm-text="">&#8203;</span></span></pre></div></div></div></div></div><div
                style="position: absolute; height: 30px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 132px;"></div><div
                class="CodeMirror-gutters" style="display: none; height: 162px;"></div></div></div></pre>
        <p>响应:
        </p>
        <figure>
            <table>
                <thead>
                <tr>
                    <th style="text-align:center;">字段名</th>
                    <th style="text-align:center;">数据类型</th>
                    <th style="text-align:center;">中文含义</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td style="text-align:center;">msg</td>
                    <td style="text-align:center;">String</td>
                    <td style="text-align:center;">消息体</td>
                </tr>
                <tr>
                    <td style="text-align:center;">status</td>
                    <td style="text-align:center;">int</td>
                    <td style="text-align:center;">状态码</td>
                </tr>
                <tr>
                    <td style="text-align:center;">data</td>
                    <td style="text-align:center;">Array</td>
                    <td style="text-align:center;">分词结果的数组</td>
                </tr>
                <tr>
                    <td style="text-align:center;">download</td>
                    <td style="text-align:center;">String</td>
                    <td style="text-align:center;">分词结果的下载路径</td>
                </tr>
                <tr>
                    <td style="text-align:center;">fileName</td>
                    <td style="text-align:center;">String</td>
                    <td style="text-align:center;">分词结果的文件名称</td>
                </tr>
                <tr>
                    <td style="text-align:center;">segResult</td>
                    <td style="text-align:center;">Array</td>
                    <td style="text-align:center;">分词后的单独的结果的数组</td>
                </tr>
                <tr>
                    <td style="text-align:center;">items</td>
                    <td style="text-align:center;">string</td>
                    <td style="text-align:center;">词汇数组，每个元素对应结果中的一个词</td>
                </tr>
                <tr>
                    <td style="text-align:center;">sentenceId</td>
                    <td style="text-align:center;">int</td>
                    <td style="text-align:center;">句子ID，标记它属于第几个句子</td>
                </tr>
                <tr>
                    <td style="text-align:center;">byte_length</td>
                    <td style="text-align:center;">int</td>
                    <td style="text-align:center;">字节级length（使用UTF-8编码），可用于后期再用过滤一元词汇等。</td>
                </tr>
                <tr>
                    <td style="text-align:center;">formal</td>
                    <td style="text-align:center;">String</td>
                    <td style="text-align:center;">词汇的标准化表达，主要针对时间、数字单位，没有归一化表达的，此项为空串</td>
                </tr>
                <tr>
                    <td style="text-align:center;">pos</td>
                    <td style="text-align:center;">String</td>
                    <td style="text-align:center;">词性，如形容词、名词</td>
                </tr>
                <tr>
                    <td style="text-align:center;">item</td>
                    <td style="text-align:center;">String</td>
                    <td style="text-align:center;">词汇的字符串</td>
                </tr>
                <tr>
                    <td style="text-align:center;">basic_words</td>
                    <td style="text-align:center;">array</td>
                    <td style="text-align:center;">字节级length（使用UTF-8编码），可用于后期再用过滤一元词汇等。</td>
                </tr>
                <tr>
                    <td style="text-align:center;">version</td>
                    <td style="text-align:center;">String</td>
                    <td style="text-align:center;">分词所用工具的以及版本版本信息</td>
                </tr>
                <tr>
                    <td style="text-align:center;">text</td>
                    <td style="text-align:center;">String</td>
                    <td style="text-align:center;">原始文本</td>
                </tr>
                </tbody>
            </table>
        </figure>
        <fieldset class="layui-elem-field layui-field-title site-title">
            <legend><a name="compatibility">格式限制</a></legend>
        </fieldset>
        <p>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            本平台允许上传的文件为txt等文本文件，其他文件会被拦截或放弃处理。
        </p>
        <fieldset class="layui-elem-field layui-field-title site-title">
            <legend><a name="compatibility">文件下载</a></legend>
        </fieldset>
        <p>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            1、文件处理完毕后会在前端弹窗显示分词的结果，用户可以拖动到窗口最下端，就能看见"文件下载"的按钮，点击下载之后就能下载文件。
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            2、在文件API接口的Response中有一个download的URL路径，用户可以通过访问该路径即可获取到完成分词后的文件。
        </p>

        <div class="layui-elem-quote">
            <p>自然语言处理与可视化平台 - 林晓民</p>
        </div>

    </div>


    <jsp:include page="/static/common/footer.jsp"></jsp:include>
    <jsp:include page="/static/common/scripts.jsp"></jsp:include>
    <script src="/static/layui/js/doc/doc.js"></script>
</body>
</html>
